<template>
  <div class="investment-progress">
    <div class="dept-rank">
      <template v-if="parseInt(deptRank) > 0">
        <div>
          第
          <span>{{ deptRank }}</span>
          名
        </div>
        <div>预警排名</div>
      </template>
      <template v-else>
        <div>{{ deptRank }}</div>
        <div>预警排名</div>
      </template>
    </div>

    <div class="card-box box">
      <div class="home-title">项目投资进度</div>
      <div class="dept-grogress">
        <div class="investment">
          <span>{{new Date().getFullYear()}}年计划总投资</span>
          <span
            >{{ investment.num }}
            <span>{{ investment.unit }}</span>
          </span>
        </div>
        <div></div>
        <div class="investment">
          <span>截止{{new Date().getMonth()+1}}月已完成</span>
          <span>
            {{ investment.num2 }} <span>{{ investment.unit }}</span>
          </span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    deptRank: {
      type: [String, Number],
      default: "",
    },
    investment: {
      type: Object,
      default: null,
    },
  },
};
</script>

<style lang="scss" scoped>
@import "./home.scss";
@import "@/views/Home/index.scss";

.investment-progress {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.dept-rank {
  height: 160px;
  background: url("/public/img/rank-bg.png") no-repeat;
  background-size: 100% 100%;
  box-sizing: border-box;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  letter-spacing: 1px;
  &:nth-child(1) {
    span {
      font-size: 26px;
    }
  }
  &:nth-child(2) {
  }
}
.card-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-top: 20px;
}

.dept-grogress {
  height: calc(100% - 50px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  box-sizing: border-box;
  div {
    width: 50%;
    height: 100px;
    border-radius: 15px;
    color: #fff;
    font-weight: 600;
    &:nth-child(1) {
      background: url("/public/img/bg-blue.png") no-repeat;
      background-size: 100% 100%;
    }
    &:nth-child(2) {
      flex: 0 0 20px;
    }
    &:nth-child(3) {
      background: url("/public/img/bg-green.png") no-repeat;
      background-size: 100% 100%;
    }
  }
  .investment {
    box-sizing: border-box;
    padding: 10px 0 10px 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    span {
      &:nth-child(1) {
        font-size: 18px;
      }
      &:nth-child(2) {
        font-size: 26px;
        > span {
          font-size: 14px;
        }
      }
    }
  }
}
</style>